<html dir="ltr" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:xlink="http://www.w3.org/1999/xlink">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="save" content="history" />
    <xml>
      <MSHelp:TOCTitle Title="Setup and Configuration" />
      <MSHelp:RLTitle Title="Setup and Configuration" />
      <MSHelp:Attr Name="DocSet" Value="docSet" />
      <MSHelp:Attr Name="TopicType" Value="kbOrient" />
      <MSHelp:Attr Name="Locale" Value="kbEnglish" />
      <MSHelp:Attr Name="AssetId" Value="{GUID}" />
    </xml>
    <title>Setup and Configuration</title>
    <link rel="stylesheet" type="text/css" href="../local/Classic.css" />
    <script src="../local/EventUtilities.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/SplitScreen.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/Dropdown.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/script.js" type="text/javascript" language="jscript"> </script>
  </head>
  <body>
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" alt="DropDown image" src="../local/drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" alt="DropDownHover image" src="../local/drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" alt="Collapse image" src="../local/collapse_all.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" alt="Expand image" src="../local/expand_all.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" alt="CollapseAll image" src="../local/collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" alt="ExpandAll image" src="../local/expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" alt="Copy image" src="../local/copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" alt="CopyHover image" src="../local/copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">OData Service for Team Foundation Server 2010 (Beta)</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">Setup and Configuration</span>
          </td>
        </tr>
        <tr id="headerTableRow3">
          <td />
        </tr>
      </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0" style="cursor:default;display:none;">
              <img id="toggleAllImage" class="toggleAll" alt="CollapseAll image" src="../local/collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">Collapse All</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">Expand All</label> </span>
            <span id="languageFilterToolTip" onmouseover="languageFilterImage.src=dropDownHoverImage.src;" onmouseout="languageFilterImage.src=dropDownImage.src;" tabindex="0" style="cursor:default;">
              <img id="languageFilterImage" alt="DropDown image" src="../local/drpdown.gif" />
              <label id="showAllLabel" for="languageFilterImage" style="display: none;">Language Filter: All</label>
              <label id="multipleLabel" for="languageFilterImage" style="display: none;">Language Filter: Multiple</label>
              <label id="vbLabel" for="languageFilterImage" style="display: none;">Language Filter: Visual Basic</label>
              <label id="csLabel" for="languageFilterImage" style="display: none;">Language Filter: C#</label>
            </span>
          </td>
        </tr>
      </table>
      <div id="languageSpan">
        <input type="checkbox" name="languageFilter" onclick="SetLanguage(this)" id="vbUsageCheckbox" />
        <label class="languageFilter" for="vbUsageCheckbox">Visual Basic Usage</label>
        <br />
        <input type="checkbox" name="languageFilter" onclick="SetLanguage(this)" id="csCheckbox" />
        <label class="languageFilter" for="csCheckbox">C#</label>
        <br />
      </div>
    </div>
    <div id="mainSection">
      <div id="mainBody">
        <div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()" />
        <p>This section describes the software requirements for running the demo.</p>
        <a name="_Toc290470859" href="#">
          <span />
        </a>
        <h3 class="subheading">Software Requirements</h3>
        <p>You must have the following items to run this demo:</p>
        <ul>
          <li>Microsoft Visual Studio 2010</li>
          <li>Microsoft Visual Studio Team Explorer 2010</li>
          <li>Microsoft .NET Framework 4</li>
          <li>WCF Data Services Toolkit (aka ODataContrib)</li>
          <li>Internet Information Services 7 (IIS7)</li>
          <li>Windows Azure Tools for Microsoft Visual Studio 2010 (November 2010 or higher)</li>
          <li>(Optional) Windows Phone Developer Tools</li>
          <li>(Optional) Microsoft WebMatrix</li>
        </ul>
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td>The Configuration Wizard is used to check the dependencies and set up the environment for this project. To launch it, browse to the root folder of this package, and double-click <b>Setup.cmd</b>.</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <a name="_Toc290470860" href="#">
          <span />
        </a>
        <h3 class="subheading">Service Configuration</h3>
        <p>After running the <b>Setup.cmd</b> command to setup the environment, modify the URL of the Team Foundation Server 2010 instance that the OData service is going to connect to. To do this, browse to <b>code\ODataTFS.Cloud</b> in the root folder of this package, open the <b>ServiceConfiguration.cscfg</b> file and modify the following value of the Settings element:</p>
        <div class="code">
          <span codeLanguage="other">
            <table width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <th>ServiceConfiguration.cscfg</th>
                <th>
                  <span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this)" onmouseover="ChangeCopyCodeIcon(this)" onfocusin="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" onfocusout="ChangeCopyCodeIcon(this)" tabindex="0">
                    <img class="copyCodeImage" name="ccImage" align="absmiddle" src="../local/copycode.gif" />Copy Code
                  </span>
                </th>
              </tr>
              <tr>
                <td colspan="2">
                  <pre>&lt;ServiceConfiguration serviceName="ODataTFS.Cloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"&gt;  &lt;Role name="ODataTFS.Web"&gt;    &lt;Instances count="1" /&gt;    &lt;ConfigurationSettings&gt;      &lt;Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" /&gt;      &lt;Setting name="DiagnosticsConnectionString" value="UseDevelopmentStorage=true" /&gt;<b>      &lt;Setting name="ODataTFS.TfsServer" value="&lt;% YourTfsUrl %&gt;" /&gt;</b>      &lt;Setting name="ODataTFS.AuthProvider" value="Microsoft.Samples.DPE.ODataTFS.Web.Infrastructure.TFSAuthProvider" /&gt;    &lt;/ConfigurationSettings&gt;    &lt;Certificates&gt;      &lt;Certificate name="codeplexodata.cloudapp.net" thumbprint="AF09E29436BF1B32176419FDDDFB4787E99FBFC1" thumbprintAlgorithm="sha1" /&gt;    &lt;/Certificates&gt;  &lt;/Role&gt;&lt;/ServiceConfiguration&gt;</pre>
                </td>
              </tr>
            </table>
          </span>
        </div>
        <br />
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td> If you want to run the OData service for TFS outside the Compute Emulator, you will need to configure the ODataTFS.TfsServer setting in the <b>Web.config</b>.</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <p>The following assemblies must be copied into <b>Libs</b> folder:</p>
        <ul>
          <li>Microsoft.Data.Services.Toolkit: WCF Data Services Toolkit (aka ODataContrib)</li>
          <li>System.Data.Services.Client: Windows Phone 7 client libraries for OData (<a href="http://odata.codeplex.com/">http://odata.codeplex.com</a>)</li>
          <li>Moq: required only to open <b>ODataTFS.Tests</b> solution (<a href="http://code.google.com/p/moq/downloads/list">http://code.google.com/p/moq/downloads/list</a>)</li>
        </ul>
        <a name="_Toc290470861" href="#">
          <span />
        </a>
        <h3 class="subheading">Windows Phone 7 Client Configuration</h3>
        <p>After configuring the OData service for TFS, you should perform the steps from below, depending whether you are running the service <b>from</b> the Compute Emulator, or <b>outside</b> the Compute Emulator:</p>
        <br />
        <a name="_Toc290470862" href="#">
          <span />
        </a>
        <p>
          <b>Running OData Service from the Compute Emulator (using a local certificate)</b>
        </p>
        <ol>
          <li>Open the <b>ODataTFS.sln</b> solution from <b>Visual Studio 2010.</b></li>
          <li>Expand the <b>ODataTFs.Web</b> project and add to the project root <b>127.0.0.1.cer</b> file located in the <b>setup\assets\</b> folder.<p><img src="images\456f6325-b92a-40e5-bbc9-ff738cb36977.png" /></p></li>
          <br />
          <li>Open <b>web.config</b> and add the highlighted lines from below inside the system.webServer tag:<div class="code"><span codeLanguage="other"><table width="100%" cellspacing="0" cellpadding="0"><tr><th>Web.config</th><th><span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this)" onmouseover="ChangeCopyCodeIcon(this)" onfocusin="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" onfocusout="ChangeCopyCodeIcon(this)" tabindex="0"><img class="copyCodeImage" name="ccImage" align="absmiddle" src="../local/copycode.gif" />Copy Code
                  </span></th></tr><tr><td colspan="2"><pre>&lt;system.webServer&gt;<b>  &lt;staticContent&gt;</b><b>    &lt;remove fileExtension=".cer" /&gt;</b><b>    &lt;mimeMap fileExtension=".cer" mimeType="application/x-x509-ca-cert" /&gt;</b><b>  &lt;/staticContent&gt;</b><b></b><b>  &lt;handlers&gt;</b><b>    &lt;remove name="SecurityCertificate" /&gt;</b><b>  &lt;/handlers&gt;</b>  ...&lt;/system.webServer&gt;</pre></td></tr></table></span></div></li>
          <br />
          <li>Press <b>F5</b> to run the solution.</li>
          <li>From the Windows Phone 7 Emulator, navigate to <a href="https://127.0.0.1/127.0.0.1.cer">https://127.0.0.1/127.0.0.1.cer</a> and install the local certificate.</li>
          <li>Click <b>Tap to open the certificate url </b>and then confirm that you want to install the certificate by clicking <b>Install</b>. Click <b>OK</b> in the confirmation page once the certificate is successfully installed.</li>
        </ol>
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td>When the service is running in the local development environment, it uses a standard certificate (“127.0.0.1.cer”) that is managed by the Compute Emulator. </td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td>The Configuration Wizard should export the “127.0.0.1” certificate (installed in the <b>Local Computer\Personal\Certificates</b> store) to the <b>\setup\assets</b> folder. In case you cannot find the certificate on that folder, you can export it manually as follows:<br />1. Open <b>mmc.exe</b> as administrator<br />2. On the <b>File</b> menu, click <b>Add/Remove</b> Snap In, and then click <b>Add</b>.<br />3. In the <b>Add Standalone Snap-in</b> dialog box, select <b>Certificates</b>, and click <b>Add</b>.<br />4. In the <b>Certificates snap-in</b> dialog box, select <b>Computer account</b> and click <b>Next.</b><br />5. In the <b>Select Computer</b> dialog box, click <b>Finish. </b>Finally, click <b>Ok</b> in the <b>Add Standalone Snap-in</b> dialog box.<br />6. In the Console Root window, click <b>Certificates (Local Computer)</b> and expand the <b>\Personal\Certificates</b> store.<br />7. Right-click the “127.0.0.1” certificate, point to <b>All Tasks</b>, and then click <b>Export</b>.<br />8. In the Certificate Export wizard, leave the default options and specify the file location to export the certificate.</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <a name="_Toc290470863" href="#">
          <span />
        </a>
        <p>
          <b>Running OData Service outside the Compute Emulator (using your own certificate)</b>
        </p>
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td><b>Important: </b>The following steps can be ignored if you use a trusted SSL certificate to deploy the OData Service for TFS, like the online version deployed to Windows Azure targeting the CodePlex TFS (<a href="https://codeplexodata.cloudapp.net/">https://codeplexodata.cloudapp.net</a>).</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <ol>
          <li>Make your SSL certificate available in a web site or blob storage.</li>
          <li>Open the <b>Windows Phone 7 Emulator</b> from <b>Start</b> | <b>All Programs</b> |<b> Windows Phone Developer Tools</b> |<b> Windows Phone 7 Emulator</b>.</li>
          <li>In the Windows Phone 7 Emulator, open <b>Internet Explorer</b> and navigate to your public certificate.</li>
          <li>Click <b>Tap to open the certificate url </b>and then confirm that you want to install the certificate by clicking <b>Install</b>. Click <b>OK</b> in the confirmation page once the certificate is successfully installed.</li>
        </ol>
        <p>
          <img src="images\8f12b05a-3ecf-4110-abfe-d5abc62151a1.png" />
        </p>
        <p>Now the Windows Phone 7 Emulator is ready to run the client application for the OData Service for TFS.</p>
        <br />
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td><b>Important</b>: If you close the Windows Phone 7 Emulator, you will need to repeat the previous configuration steps.</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <a name="_Toc290470864" href="#">
          <span />
        </a>
        <h3 class="subheading">ODataForTFS WebMatrix Helper Configuration</h3>
        <p>Before using the WebMatrix Helper, you will need to create the required Areas in TFS for your application and then configure the parameters to initialize the helper.</p>
        <div class="alert">
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr>
              <th align="left">
                <img class="note" src="../local/note.gif" />Note:</th>
            </tr>
            <tr>
              <td>For more detailed information about the ODataForTFS WebMatrix Helper, review its documentation located in the <b>code\ODataTFS.WebMatrixHelper\ODataForTFS\Docs</b> folder.</td>
            </tr>
          </table>
          <p />
        </div>
        <br />
        <p>This package ships with a sample WebMatrix application that requires the <b>Default</b>, <b>About</b>, <b>Order</b> and <b>OrderSuccess</b> areas (one area for each page). To configure a TFS Team Project for this application you need to follow the following steps:</p>
        <ol>
          <li>Open <b>Microsoft Visual Studio 2010</b> and connect to your Team Foundation Server instance using <b>Team Explorer</b>.</li>
          <li>In <b>Team Explorer</b>, right-click the team project that you will use for logging the bugs of the sample WebMatrix application, point to <b>Team Project Settings</b> and click <b>Areas and Iterations</b>.<p><img src="images\dcd20a1f-542c-427e-bd0d-26a75f3c1e9a.png" /></p><br /></li>
          <li>In the <b>Areas and Iterations</b> dialog, create the <b>Default</b>, <b>Order</b>, <b>About</b> and <b>OrderSuccess</b> areas below the main area in the project.<div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left"><img class="note" src="../local/note.gif" />Note:</th></tr><tr><td>We are creating one TFS Area for each page in the WebMatrix application.</td></tr></table><p /></div><br /><p><img src="images\ed74bb05-14f4-4306-9883-c4820134026d.png" /></p><br /></li>
          <li>Open the sample WebMatrix application shipped with this package. To do this, navigate to the <b>code</b> folder, right-click the <b>ODataTFS.WebMatrixHelper.Sample</b> folder and select <b>Open as a Web Site with Microsoft WebMatrix</b>.</li>
          <li>In <b>WebMatrix</b>, double-click the <b>_AppStart.cshtml</b> file to open it and modify the parameters in the call to the <b>ODataForTFS.Initialize</b> method with your right values.<p><img src="images\7b085bdf-c784-4fcb-91ca-c56a88090437.png" /></p><br /></li>
          <li>In <b>WebMatrix</b>, double click the <b>ODataForTFS.cshtml</b> file located under the <b>App_Code</b> folder to open it and modify the value of the <b>TFSDefaultWorkItemType</b> constant to a valid Work Item type in your TFS team project.<p><img src="images\86ef15f5-ce24-4ef2-be3e-4b495bd648b2.png" /></p></li>
          <br />
          <li>When running the sample, look for the <b>File Bug</b> and <b>Known Issues</b> buttons on the bottom-right corner of the page.<a name="_GoBack" href="#"><span /></a><p><img src="images\97a9b32d-a47a-40aa-9487-3aafce689a9c.png" /></p></li>
        </ol>
        <h1 class="heading">Next Step</h1>
        <p>
          <a href="docSet_61254a2b-3f48-4428-9786-3252fb0f4b30.html">Connecting to the Service</a>
        </p>
      </div>
      <div id="footer">
        <div class="footerLine">
          <img src="../local/footer.gif" alt="Footer image" width="100%" height="3px" />
        </div>
    To give feedback.
  <p />Copyright © 2011 by Microsoft Corporation. All rights reserved.</div>
    </div>
  </body>
</html>